<template>
    <div
        class="annualcharge"
        v-loading="pageLoading"
        element-loading-background="rgba(255, 255, 255, 0.7)"
    >
        <cardComponent pageTitle="年费方案调整">
            <template slot="cardBody">
                <div class="formContainer" v-show="!ifauditpass">
                    <!-- 搜索表单模块 -->
                    <el-form
                        class="searchForm formData_form_inline"
                        ref="searchForm"
                        :model="searchForm"
                        label-position="right"
                        :rules="formRules"
                        size="small"
                        :inline="true"
                        label-width="180px"
                    >
                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="账户类别：" class="text_fl">
                                    <el-select
                                        v-model="searchForm.accountType"
                                        placeholder="请选择账户类别"
                                        clearable
                                        @change="changeAcctList"
                                    >
                                        <el-option
                                            v-for="item in AccountionTYPE_INFO"
                                            :label="item.label"
                                            :value="item.code"
                                            :key="item.label"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="卡号:" class="text_fl">
                                    <el-select
                                        v-model="searchForm.cardno"
                                        placeholder="请选择卡号"
                                        clearable
                                        @change="changeCardList"
                                    >
                                        <el-option
                                            v-for="item in cardList"
                                            :label="item.CARDNBR"
                                            :value="item.CARDNBR"
                                            :key="item.CARDNBR"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="卡片产品：" class="text_fl">
                                    <span
                                        class="el-form-item-span"
                                    >{{searchForm.prod|filterCardprod(cardprodList)}}</span>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="卡片状态：" class="text_fl">
                                    <span
                                        class="el-form-item-span"
                                    >{{searchForm.cardsts|filterCardstat(cardstsList)}}</span>
                                    <div class="inlineDiv">
                                        <span
                                            style="color:red;"
                                            class="form_item_span"
                                        >{{searchForm.cardsts===''?'':'卡状态异常，不通过' }}</span>
                                    </div>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="账单日：" class="text_fl">
                                    <span class="el-form-item-span">{{searchForm.stmtday }}日</span>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="下次年费收取时间：" class="text_fl">
                                    <span class="el-form-item-span">{{searchForm.nextfeemonth }}</span>
                                    &nbsp;
                                    <span
                                        class="form_item_span"
                                    >(YYMM)</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="是否在上次方案执行期内：" class="text_fl">
                                    <span
                                        class="el-form-item-span"
                                    >{{searchForm.alreadyin==='0'?'否':'是' }}</span>
                                    <div style="height:20px;">
                                        <span
                                            class="form_item_span"
                                            style="color:red;"
                                        >{{searchForm.alreadyin==='0'?'':'不通过' }}</span>
                                    </div>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="是否存在减免政策：" class="text_fl">
                                    <span
                                        class="el-form-item-span"
                                    >{{searchForm.ifhasrule==='1'?'是':'否' }}</span>
                                    <div style="height:20px;">
                                        <span
                                            class="form_item_span"
                                            v-if="searchForm.ifhasrule==='0'"
                                            style="color:red;"
                                        >无减免政策，不通过</span>
                                        <span
                                            class="form_item_span"
                                            v-if="searchForm.ifhasrule==='2'"
                                            style="color:red;"
                                        >暂免，不通过</span>
                                    </div>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row class="buttonBox">
                            <el-button
                                type="primary"
                                size="small"
                                @click="audit"
                            >初&nbsp;&nbsp;&nbsp;&nbsp;审</el-button>
                        </el-row>
                    </el-form>
                </div>

                <div v-show="ifauditpass">
                    <el-form ref="formData" :model="formData" label-width="40%">
                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="卡号：" class="text_fl">
                                    <span class="el-form-item-span">{{searchForm.cardno }}</span>
                                </el-form-item>
                            </el-col>

                            <el-col :span="11">
                                <el-form-item label="账单日期：" class="text_fl">
                                    <span class="el-form-item-span">{{searchForm.stmtday }}日</span>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="本期账单未还金额：" class="text_fl">
                                    <span class="el-form-item-span">{{this.curBillNotRepayAmt }}</span>
                                </el-form-item>
                            </el-col>
                            <el-col :span="11">
                                <el-form-item label="最后还款日：" class="text_fl">
                                    <span class="el-form-item-span">{{this.finalRepayDate }}</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="11" :offset="1">
                                <el-form-item label="执行日期：" class="text_fl">
                                    <span class="el-form-item-span">{{formData.executionDate }}</span>
                                </el-form-item>
                            </el-col>
                            <el-col :span="11">
                                <el-form-item label="减免条件：" class="text_fl">
                                    <span>{{this.reductionCondition}}</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="20" :offset="1" v-show="ifsuccess">
                                <div class="text_center width30">
                                    <div class="el-form-item-span-wrap">
                                        <div class="text_span text_center">年费方案调整申请成功!</div>
                                    </div>
                                </div>
                            </el-col>
                        </el-row>
                        <!-- 话术 -->
                        <div class="hstable_wrap" v-if="speechList.length!=0">
                            <el-table
                                :data="speechList"
                                border
                                stripe
                                header-row-class-name="headerRow"
                                ref="showListTable"
                                class="heard-bg business_table hstable"
                                @selection-change="handleSelectionChange"
                            >
                                <el-table-column type="selection" label=" " min-width="55"></el-table-column>
                                <el-table-column label="业务话术">
                                    <template slot-scope="scope">{{scope.row.content}}</template>
                                </el-table-column>
                            </el-table>
                        </div>
                        <div class="text_center">
                            <el-button
                                v-show="!ifsuccess"
                                type="primary"
                                size="small"
                                @click="handerCardFeeReduction"
                            >调&nbsp;&nbsp;&nbsp;&nbsp;整</el-button>

                            <el-button
                                v-show="!ifsuccess"
                                type="primary"
                                size="small"
                                @click="goback"
                            >返&nbsp;&nbsp;&nbsp;&nbsp;回</el-button>
                            <el-button
                                type="primary"
                                size="small"
                                @click="sendMsg"
                                v-show="ifsuccess"
                            >发送短信</el-button>

                            <el-button
                                type="primary"
                                size="small"
                                @click="updatehistory"
                                v-show="ifsuccess"
                            >修改记录查询</el-button>
                        </div>
                    </el-form>
                </div>
                <!-- 转出结果展示 -->
                <!-- 以下弹窗 -->
                <el-dialog
                    v-drag
                    title="年费减免"
                    :visible.sync="centerDialogVisible"
                    width="400px"
                    :append-to-body="true"
                    top="30vh"
                    :close-on-click-modal="false"
                    center
                >
                    <p>
                        卡号：
                        <span>{{this.searchForm.cardno}}</span>
                    </p>
                    <p>
                        卡种:
                        <span>{{this.searchForm.prod|filterCardprod(cardprodList)}}</span>
                    </p>
                    <p style="text-align:center;padding-left:0px;">
                        <span style="color:#3a8ee6; ">您确认要办理年费方案调整吗？</span>
                    </p>
                    <span slot="footer" class="dialog-footer">
                        <el-button
                            size="small"
                            icon="el-icon-circle-close"
                            @click="centerDialogVisible = false"
                        >取 消</el-button>
                        <el-button
                            type="primary"
                            size="small"
                            @click="setsubmitForm"
                            icon="el-icon-circle-check"
                        >确定</el-button>
                    </span>
                </el-dialog>
            </template>
        </cardComponent>
    </div>
</template>

<script>
import { mapState } from 'vuex';
import moment from 'moment';
import cardComponent from '@/components/cardComponent/cardComponent.vue';
import { getDictSelectList, itoStr, trimString, getBusinessMenuId } from '@/utils/Common';
import { RegConfig } from '@/utils/RegConfig';

export default {
    name: 'annualcharge',
    components: {
        cardComponent,
    },
    data() {
        return {
            outButtonFlag: true,
            pageLoading: false, // 页面loading
            isShowDialog: false, // 对话框显示控制阀
            cardstsList: [],
            cardprodList: [],
            searchForm: { // 搜索表单字段
                accountType: '', // 账户类别
                cardno: '',//卡号
                prod: '',//卡产品编号
                cardsts: '',//卡片状态
                stmtday: '',//账单日
                nextfeemonth: '',//下次年费收取月份YYMM
                alreadyin: '0',//是否在执行账期内,0-否，1-是
                ifhasrule: '0',//是否存在年费减免政策，0-否，1-是，2-暂免

            },
            // 转出成功信息
            rollOutData: {
                BANKACCT: '', // 申请转入的银行卡号
                OVERPAYAMT: '', // 溢缴款金额
                BANKNO: '', // 申请转入的银行行号
                BANKNAME: '', // 申请转入的银行卡银行名称
            },
            // 表单字段校验规则
            formRules: {
                shiftIntoCardNo: [
                    { required: true, message: '请输入转入卡号', trigger: 'blur' },
                    { pattern: RegConfig.cardNo, message: '请输入13-21位的银行卡账号', trigger: 'blur' },
                ],
                OVERPAYAMT: [
                    { required: true, message: '请输入转出金额', trigger: 'blur' },
                    { pattern: RegConfig.amount, message: '请输入正确的金额', trigger: 'blur' },
                ],
            },
            OXFRAVALX: '0',
            cardList: [],
            outFlag: [],//跨行标志，0-不跨行，1-跨行
            ifCheckOut: false,//是否显示借记卡验证按钮
            ifPass: '0',//是否通过借记卡验证，0-未通过，1-通过
            formData: {
                CARDNO: '',//卡号
                CYNBR: '',// 账单日
                CHGDY: '',// 上次帐单日修改日期
                CYCLENBRSVal: '',//有效账单日
                CYCLENBRS_option: [],
                CYCLENBRS_option_value: '',
                startAcctDate: '', //开始账期
                endAcctDate: '', //结束账期
                executionDate: '', //执行日期
                currentDateStr: '', //获取服务器当前日期 eg.20210518
            },
            speechCraftList: [], //卡种年费方案列表
            auditPage: false,
            cardFeeRule: {}, //卡费规则描述
            ifauditpass: false,

            curBillNotRepayAmt: '', //本期账单未还金额
            finalRepayDate: '', //最后还款日
            reductionCondition: '',//减免条件
            centerDialogVisible: false,//二次确认框是否显示
            ifsuccess: false,//年费方案是否交易成功
            adjustresult: '',//年费方案交易结果描述
            speechList: [],//话术列表
            selectedList: [],
            MenuId: '',
        };
    },

    created() { },

    // 取缓存信息
    computed: mapState({
        cardInfo_3004: state => state.common.cardInfo_3004, // 默认卡信息
        cardInfo_3001: state => state.common.cardAccountInfo_3001, // 默认卡信息
        defaultParams: state => state.common.defaultParams, // 接口默认参数
        pinFlag: state => state.common.pinFlag, // 是否密码检查标志
        AccountionTYPE_INFO: state => state.common.AccountionTYPE_INFO, //账户类别列表
        cardList_3601: state => state.common.cardList_3601, //卡列表
        isCurrentMenuInfo: state => state.menu.isCurrentMenuInfo,
        businessMenu: state => state.menu.businessMenu,
    }),
    filters: {

        filterCardstat: (value, cardstsList) => {
            value = (`${value}`).trim();
            if (value === '') {
                return '正常';
            }
            for (let index = 0; index < cardstsList.length; index++) {
                const element = cardstsList[index];
                if (element.code === value) {
                    return element.label;
                }
            }
        },
        filterCardprod: (value, cardprodList) => {
            value = (`${value}`).trim();

            for (let index = 0; index < cardprodList.length; index++) {
                const element = cardprodList[index];
                if (element.code === value) {
                    return element.label;
                }
            }
        },
    },
    async mounted() {
        this.MenuId = this.$route.params.id || '';
        //this.outFlag = await getDictSelectList('OUTFLAG', this);
        this.cardstsList = await getDictSelectList('CLOCD', this);
        this.cardprodList = await getDictSelectList('PRODUCT', this);
        await this.init();
    },
    methods: {
        // 初始化方法
        async init() {

            console.log("默认账户类别：" + this.cardInfo_3004.CATEGORY + "，账单日期：" + this.cardInfo_3001.CYCLNBR);
            console.log("默认账户：" + this.cardInfo_3004.CARDNO + "，默认卡产品编号：" + this.cardInfo_3004.PRODUCT + ",下次年费收取时间：" + this.cardInfo_3004.FEEMONTH + ",");

            this.searchForm.accountType = this.cardInfo_3004.CATEGORY + '';
            this.searchForm.cardno = this.cardInfo_3004.CARDNO;
            this.searchForm.prod = itoStr(this.cardInfo_3004.PRODUCT, 4);
            this.searchForm.nextfeemonth = this.cardInfo_3004.FEEMONTH;
            this.searchForm.cardsts = trimString(this.cardInfo_3004.CARDSTAT);
            this.searchForm.stmtday = this.cardInfo_3001.CYCLNBR;

            this.curBillNotRepayAmt = this.cardInfo_3001.DUEAMT;//本期账单未还金额
            this.finalRepayDate = this.cardInfo_3001.DUEDATE;//到期还款日

            //查询上次年费方案信息
            await this.getLastFeeData();

            //查询当前卡号后台数据库配置的年费
            console.log("this.searchForm.prod:", this.searchForm.prod);
            await this.loadSpeechList(this.searchForm.prod);

            await this.changeAcctList(this.cardInfo_3004.CATEGORY);
            await this.getspeechList();
        },
        //切换账户，更新卡号下拉框
        async changeAcctList(val) {
            console.log("当前账户类型：" + val);

            let hasDefault = false; //是否包含默认卡
            this.cardList = [];

            for (let i = 0; i < this.cardList_3601.length; i++) {
                if (parseInt(this.cardList_3601[i].CATEGORY) === parseInt(val)) {
                    this.cardList.push(this.cardList_3601[i]);
                    if (this.cardList_3601[i].CARDNBR === this.cardInfo_3004.CARDNO) {
                        hasDefault = true;
                    }
                }

            }
            console.log("this.cardList", this.cardList);
            //包含默认卡，卡号显示默认卡，不包含，显示cardList里第一张卡号
            if (hasDefault) {
                this.searchForm.cardno = this.cardInfo_3004.CARDNO;
            } else {
                this.searchForm.cardno = this.cardList[0].CARDNBR;
            }

            //重调切换卡号事件，更新判断条件信息
            await this.changeCardList(this.searchForm.cardno);
            // 获取当前卡账户的信息 跑 3001 交易
            //this.getInitData();
        },
        //根据菜单id查询话术列表
        async getspeechList() {
            console.log("this.isCurrentMenuInfo.id", this.isCurrentMenuInfo.id);
            console.log("this.MenuId", this.MenuId);
            var checkParam = {
                'id': this.MenuId || this.isCurrentMenuInfo.id,
            };
            this.$post.busiMenu.getlistByMenuId(checkParam).then((res) => {
                console.log("话术查询结果：", res);
                if (res.status === 200) { // http通讯成功
                    if (res.data.status == 0) { // 业务请求成功
                        this.speechList = res.data.content;
                    }
                }
            });
        },
        handleSelectionChange(val) {
            this.selectedList = val;
        },
        //切换卡号
        async changeCardList(val) {
            console.log("当前卡号|" + val + "|" + this.cardInfo_3004.CARDNO + "|");

            //if (val != this.cardInfo_3004.CARDNO) {
            //重新查询3001，获取账单日
            await this.get3001(val);

            //重新查询3004，获取卡产品、下次年费收取时间、卡状态
            await this.get3004(val);

            //查询上次年费方案信息
            await this.getLastFeeData();

            //查询当前卡号后台数据库配置的年费
            console.log("this.searchForm.prod:", this.searchForm.prod);
            await this.loadSpeechList(this.searchForm.prod);
            // }



        },
        //3152交易查询年费历史调整记录
        async getLastFeeData() {
            let params = {
                CARDNBR: this.searchForm.cardno,//卡号
                PINFLAG: this.pinFlag,// 验密，不检查
                RTNRESERVED: '',// 保留域
                RTNIND: '',// 翻页标志
                CLEARFLG: '0',// 处理结果
                ACTDAY: '0',// 年费调整方案执行日期
                INPTIME: '0',// 年费调整方案输入时间
                // 
            }
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3152';// 修改交易号
            defaultParams.body.appBody = params;

            await this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) { // 请求成功
                    const transRes = JSON.parse(res.data.jsonRes);
                    console.log('transfer3152Res', transRes);
                    if (transRes.sysHead.rspCd == '000000') { // 交易成功
                        //如果查询结果列表有值，取第一条记录做判断，因为卡系统是按时间倒叙查询返回的
                        if (transRes.body.appBody.COUNT > 0) {
                            let obj = transRes.body.appBody.dataList[0];
                            console.log("obj:", obj);
                            let nowdate = moment(new Date()).format('YYYYMMDD');//当前时间
                            let startdate = obj.STRMTH + '' + this.searchForm.stmtday;
                            let enddate = obj.ACTDAY;
                            if (parseFloat(nowdate) > parseFloat(startdate) && parseFloat(nowdate) <= parseFloat(enddate)) {
                                this.searchForm.alreadyin = '1';
                            } else {
                                this.searchForm.alreadyin = '0';
                            }
                        }
                    } else {
                        this.searchForm.alreadyin = '0';
                    }
                }
            });
        },

        //根据卡产品编号查询数据库配置的年费相关信息
        async loadSpeechList(product) {
            let cardfeeQueryParam = {
                // 'cardTypeNo': this.cardtypeNo, 
                'cardTypeNo': parseInt(product),
            };
            await this.$post.queryServiceClass.getCardfeeByCardTypeNo(cardfeeQueryParam).then((res) => {
                if (res.status === 200) { // http通讯成功
                    if (res.data.status == 0) { // 业务请求成功
                        if (res.data.content) {
                            this.cardFeeRule = res.data.content;
                            console.log("this.cardFeeRule", this.cardFeeRule);
                            this.searchForm.ifhasrule = this.cardFeeRule.ifhasrule;
                            this.reductionCondition = this.cardFeeRule.cardfeeReductionCondition;
                        } else {
                            this.searchForm.ifhasrule = '0';
                        }
                    } else {
                        this.searchForm.ifhasrule = '0';
                    }
                }
            });
        },

        //3001交易
        async get3001(cardno) {
            let params = {
                CARDNO: this.searchForm.cardno,//卡号
                PINFLAG: this.pinFlag,// 验密，不检查
                PIN: '',// 保留域
            }
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3001';// 修改交易号
            defaultParams.body.appBody = params;

            await this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) { // 请求成功
                    const transRes = JSON.parse(res.data.jsonRes);
                    console.log('transfer3001Res查询成功', transRes);
                    if (transRes.sysHead.rspCd == '000000') { // 交易成功
                        this.searchForm.stmtday = transRes.body.appBody.CYCLNBR;
                        this.curBillNotRepayAmt = transRes.body.appBody.DUEAMT;//本期账单未还金额
                        this.finalRepayDate = transRes.body.appBody.DUEDATE;//到期还款日
                    }
                }
            });
        },

        //3004交易
        async get3004(cardno) {
            let params = {
                CARDNO: this.searchForm.cardno,//卡号
                PINFLAG: this.pinFlag,// 验密，不检查
                PIN: '',// 保留域
            }
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3004';// 修改交易号
            defaultParams.body.appBody = params;

            await this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) { // 请求成功
                    const transRes = JSON.parse(res.data.jsonRes);
                    console.log('transfer3004Res查询成功', transRes);
                    if (transRes.sysHead.rspCd == '000000') { // 交易成功
                        this.searchForm.prod = itoStr(transRes.body.appBody.PRODUCT, 4);
                        this.searchForm.cardsts = trimString(transRes.body.appBody.CARDSTAT);
                        this.searchForm.nextfeemonth = transRes.body.appBody.FEEMONTH;
                    }
                }
            });
        },

        /**
        * 年费调整方案初审，判断卡片是否满足年费调整条件
        */
        audit() {
            console.log("this.searchForm.cardno", this.searchForm.cardno);
            //第一步、先判断初审条件是否通过
            let unpassmsg = '';
            let ifcardsts = false;
            let ifrule = false;
            let ifalready = false;
            //1、卡状态是否异常
            if (this.searchForm.cardsts === '') {
                ifcardsts = true;
            } else {
                ifcardsts = false;
                unpassmsg = '卡状态不正常，';
            }

            //2、是否存在减免政策
            if (this.searchForm.ifhasrule === '1') {
                ifrule = true;
            } else if (this.searchForm.ifhasrule === '2') {
                ifrule = false;
                unpassmsg = unpassmsg + '年费暂免，';
            } else {
                ifrule = false;
                unpassmsg = unpassmsg + '无减免政策，';
            }
            //3、是否在上次年费方案执行期内
            if (this.searchForm.alreadyin === '0') {
                ifalready = true;
            } else {
                ifalready = false;
                unpassmsg = unpassmsg + '当前时间在上次方案执行期内，';
            }

            if (!ifcardsts || !ifrule || !ifalready) {
                this.ifauditpass = false;
                this.$alert(unpassmsg + '不能办理年费减免！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            } else {
                this.ifauditpass = true;

                //计算执行日期\开始账期、结束账期
                let nextmonth = moment(new Date()).subtract(-1, 'months').format('YYYYMMDD');
                let nowdate = moment(new Date()).format('YYYYMMDD');
                console.log('查看年费减免——————', "nextmonth:", nextmonth, "nowdate", nowdate, "this.searchForm.stmtday", this.searchForm.stmtday);
                let tmp = nextmonth.substr(0, 6).concat(this.searchForm.stmtday > 9 ? this.searchForm.stmtday : ('0' + this.searchForm.stmtday));
                let beforestmtday = moment(tmp, 'YYYYMMDD').subtract(1, 'days').format('YYYYMMDD');
                console.log('年费减免2_____', 'tmp', tmp, "beforestmtday", beforestmtday);
                this.formData.startAcctDate = nowdate.substr(0, 6); //开始账期
                this.formData.endAcctDate = nextmonth.substr(0, 6); //结束账期
                console.log('年费减免——————————', nextmonth, "beforestmtday", beforestmtday);
                this.formData.executionDate = nextmonth.substr(0, 6).concat(beforestmtday.substr(6, 2));//执行日期
            }
            // this.ifauditpass = true;
            // //计算执行日期\开始账期、结束账期
            // let nextmonth = moment(new Date()).subtract(-1, 'months').format('YYYYMMDD');
            // let nowdate = moment(new Date()).format('YYYYMMDD');
            // let beforestmtday = parseInt(this.searchForm.stmtday) - 1;

            // this.formData.startAcctDate = nowdate.substr(0, 6); //开始账期
            // this.formData.endAcctDate = nextmonth.substr(0, 6); //结束账期
            // this.formData.executionDate = nextmonth.substr(0, 6).concat(beforestmtday);//执行日期
        },

        //二次确认框
        handerCardFeeReduction() {
            if (this.selectedList.length != this.speechList.length) {
                this.$alert('话术尚未全部勾选！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            }
            this.centerDialogVisible = true;// 确认弹窗
        },

        // // 发送请求 年费减免 4050 
        setsubmitForm() {
            this.centerDialogVisible = false;
            let params = {
                CARDNBR: this.searchForm.cardno,//卡号
                PINFLAG: this.pinFlag,// 验密，不检查
                OPERATE: '0',// 操作类型：0：输入
                BEGINMTH: this.formData.startAcctDate,//开始账期，操作类型是0时必填
                ENDMTH: this.formData.endAcctDate,// 结束账期，操作类型是0时必填
                ACTDAY: this.formData.executionDate,// 执行日期
                TOTAMT: this.cardFeeRule.totAmt,//累计交易金额，操作类型是0时必填
                TOTCNT: this.cardFeeRule.totCnt,//累计交易次数，操作类型是0时必填
            }
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '4050';// 修改交易号
            defaultParams.body.appBody = params;

            this.$post.common.transPort(defaultParams).then((res) => {

                if (res.status === 200) { // 请求成功
                    const transRes = JSON.parse(res.data.jsonRes);
                    console.log(transRes, 'CardFeeReduction_4050');
                    this.adjustresult = transRes.sysHead.rspMsg;
                    if (transRes.sysHead.rspCd == '000000') { // 交易成功
                        this.ifsuccess = true;
                        this.CardFeeReduction_4050 = transRes;
                    } else {
                        const ErrorMessage = `错误码：${transRes.sysHead.rspCd} ` + `错误信息：${transRes.sysHead.rspMsg}`;
                        this.$alert(ErrorMessage, transRes.sysHead.busiName, { customClass: 'error', type: 'error' });
                    }
                }
            });
        },

        //返回
        goback() {
            this.ifauditpass = false;
        },

        //发送短信
        sendMsg() {
            const tempContent = `您申请的年费减免方案已提交成功，如果您在${this.formData.executionDate}${this.reductionCondition}。`;
            this.$router.push({
                name: 'dynamicMessage',
                path: '/index/dynamicMessage',
                params: {
                    tempName: '100009-年费方案调整',
                    tempContent,
                },
            });
        },
        updatehistory() {
            this.MenuId = getBusinessMenuId('/businessSystem/accountCardDetaileQuery', this.businessMenu);
            console.log('this.MenuId____', this.MenuId);
            this.$router.push({ name: 'accountCardDetaileQuery', path: '/businessSystem/accountCardDetaileQuery', params: { id: this.MenuId } });
        },
        // 点击重置搜索表单
        handleReset() {
            this.$refs.searchForm.resetFields();
        },

        // 点击关闭对话空框
        handleCloseDialog() {
            this.isShowDialog = false;
        },
    },
};
</script>
<style rel="stylesheet/scss" lang="scss">
.annualcharge {
    .searchForm {
        .el-form-item__content {
            text-align: left;
        }
    }
}
</style>
<style scoped lang="scss">
.annualcharge {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;

    .buttonBox {
        text-align: center;
        margin: 50px 0 0 0;
        padding-right: 30px;
    }
    .form_item_span {
        height: 30px;
        line-height: 30px;
    }
    .text_span {
        margin: 15px 20px;
        font-size: 16px;
    }
}

.messageDialog {
    .el-row {
        margin-bottom: 30px;

        .infoItem {
            .title {
                font-weight: 600;
                padding-right: 10px;
            }

            .info {
                color: #999;
            }
        }
    }
}
</style>
